<%@ page contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<jsp:include page="../include/header.jsp" />
<script type="text/javascript" src="<c:url value='/htmlRes/js/tableAddDelete.js'/>"></script>
<script type="text/javascript" src="<c:url value='/htmlRes/js/datepicker/jquery.ui.core.js'/>"></script>
<script type="text/javascript" src="<c:url value='/htmlRes/js/datepicker/jquery.ui.datepicker.js'/>"></script>
<script type="text/javaScript">
<!--
	function appendRow(id, sampleId){
		$('#'+id).appendRow({sampleTRObj:sampleId});
	}
	
	function deleteRow(id){
		$('#'+id).deleteRow();
	}
	
	function saveFormPage() {
		$('#writeForm input[type=text]').each(function(n,element){  
            if ($(element).val()=='') {  
              	
            	var temp_id = element.id;
            	var temp_sp = temp_id.split("-");
            	
            	alert(temp_sp[1]+"번째 약품명을 확인해주세요. \n약품명은 필수 입니다.");
            	
            	document.getElementById(temp_id).focus();
              
              return false;  
            }  
          });
	
		if(confirm("업무일지의 약품명이 반영됩니다.")){
			$('#writeForm').submit();
		}
		
	}

-->
</script>
<!-- contents s -->
<div class="container" id="container">
	<span class="round lt" style="">&nbsp;</span>
	<span class="round rt">&nbsp;</span>
	<span class="round lb">&nbsp;</span>
	<span class="round rb">&nbsp;</span>
	<div class="container_area">
	<form name="writeForm" id="writeForm" action="<c:url value="/inven/invenSave.do"/>" method="post">
		<h2 class="tit_h2">약품관리</h2>
			<jsp:include page="../include/navi.jsp" />
			<span class="ico_print"><a href="#print"  onclick="printPage('<c:url value="/common/printView.do" />');return false;"><img src="/htmlRes/images/ico_print.jpg" alt="인쇄버튼"></a></span>
			<!-- 
			<div class="srch_wrap">
			</div>
			-->

				<h3 class="tit_h3">약품관리</h3>
				
				<div class="btn_bbs type_pm">
					<a href="#appendRow" onclick="appendRow('invenTable','invenBaseTr');return false;" class="btn_pm">+</a>
				</div>
				
				<div class="table_wrap"><!-- D : table은 div table_wrap 싸고감 -->
					<table summary="약품관리 테이블 입니다" class="table_list" id="invenTable">
						<caption>약품관리</caption>
						<colgroup> <!-- D : col width로 테이블 넓이 조절 -->
							<col width="45%" />
							<col width="10%" />
						</colgroup>
						<thead>
							<tr>
								<th scope="col">약품명</th>
								<th scope="col">사용여부</th>
							</tr>
						</thead>
						<tbody>
						<c:if test="${not empty resultList}">
							<c:forEach var="result" items="${resultList }" varStatus="status"> 
							<tr <c:if test="${status.first }">id="invenBaseTr"</c:if> class="_calcBtype">
								<td style="display:none;"><input type="text" name="codeVoList[${status.count-1}].scc_code_key" value="${result.scc_code_key }" class="_codeKey"/></td>
								<td><input type="text" size="60" name="codeVoList[${status.count-1}].scc_code_name" id="scc_code_name-${status.count}" value="${result.scc_code_name }" /></td>
								<td>
									<select name="codeVoList[${status.count-1}].scc_flag_yn">
										<option value="Y">사용</option>
										<option value="N"
											<c:if test="${result.scc_flag_yn == 'N' }">
												selected
											</c:if>
										>미사용</option>
									</select>
								</td>
							</tr>
							</c:forEach>
						</c:if>
						</tbody>
					</table>
				</div><!--//table_wrap-->
	</form>
		<div class="btn_bbs">
			<a href="#" onclick="saveFormPage();return false;" class="btn_re">수정 완료</a>
		</div>
	</div><!--//container_area-->
				
</div>

	<!-- contents e -->
<jsp:include page="../include/footer.jsp" />